#!/usr/bin/env bash

# Slurm: use scontrol to manage nodes
# Homepage: https://github.com/OleHolmNielsen/Slurm_tools/

ACTION=drain

if test $# -eq 2
then
	NODES="$1"
	REASON="$2"
else
	echo Usage: $0 nodename-list \"Reason\"
	exit 1
fi

/usr/bin/scontrol update nodename=$NODES state=$ACTION reason="$REASON"
/usr/bin/sinfo -N -n $NODES --list-reasons
